home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / basic / ace_final.lha / ACE_GPL_Release / include / libraries / gadtools.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-29  |  17.4 KB  |  471 lines

  1. #ifndef LIBRARIES_GADTOOLS_H
  2. #define LIBRARIES_GADTOOLS_H 1
  3. /*
  4. ** gadtools.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/01/95
  11. **
  12. **
  13. */
  14.  
  15. /*
  16. ** This are the StructPointer defines for gadtools.h
  17. */
  18. #ifndef LVDrawMsgPtr
  19. #define LVDrawMsgPtr ADDRESS
  20. #endif
  21. #ifndef NewGadgetPtr
  22. #define NewGadgetPtr ADDRESS
  23. #endif
  24. #ifndef NewMenuPtr
  25. #define NewMenuPtr ADDRESS
  26. #endif
  27. /*
  28. ** End of StructPointer defines for gadtools.h
  29. */
  30.  
  31.  
  32. /*------------------------------------------------------------------------*/
  33.  
  34. #ifndef EXEC_TYPES_H
  35. #include <exec/types.h>
  36. #endif
  37.  
  38. #ifndef UTILITY_TAGITEM_H
  39. #include <utility/tagitem.h>
  40. #endif
  41.  
  42. #ifndef INTUITION_INTUITION_H
  43. #include <intuition/intuition.h>
  44. #endif
  45.  
  46. /*------------------------------------------------------------------------*/
  47.  
  48. /* The kinds (almost classes) of gadgets that GadTools supports.
  49.  * Use these identifiers when calling CreateGadgetA()
  50.  */
  51.  
  52. #define GENERIC_KIND    0
  53. #define BUTTON_KIND 1
  54. #define CHECKBOX_KIND   2
  55. #define INTEGER_KIND    3
  56. #define LISTVIEW_KIND   4
  57. #define MX_KIND     5
  58. #define NUMBER_KIND 6
  59. #define CYCLE_KIND  7
  60. #define PALETTE_KIND    8
  61. #define SCROLLER_KIND   9
  62. /* Kind number 10 is reserved */
  63. #define SLIDER_KIND 11
  64. #define STRING_KIND 12
  65. #define TEXT_KIND   13
  66.  
  67. #define NUM_KINDS   14
  68.  
  69. /*------------------------------------------------------------------------*/
  70.  
  71. /* 'Or' the appropriate set together for your Window IDCMPFlags: */
  72.  
  73. #define ARROWIDCMP  (IDCMP_GADGETUP OR IDCMP_GADGETDOWN OR \
  74.     IDCMP_INTUITICKS OR IDCMP_MOUSEBUTTONS)
  75.  
  76. #define BUTTONIDCMP (IDCMP_GADGETUP)
  77. #define CHECKBOXIDCMP   (IDCMP_GADGETUP)
  78. #define INTEGERIDCMP    (IDCMP_GADGETUP)
  79. #define LISTVIEWIDCMP   (IDCMP_GADGETUP OR IDCMP_GADGETDOWN OR \
  80.     IDCMP_MOUSEMOVE OR ARROWIDCMP)
  81.  
  82. #define MXIDCMP     (IDCMP_GADGETDOWN)
  83. #define NUMBERIDCMP (0&)
  84. #define CYCLEIDCMP  (IDCMP_GADGETUP)
  85. #define PALETTEIDCMP    (IDCMP_GADGETUP)
  86.  
  87. /* Use ARROWIDCMP|SCROLLERIDCMP if your scrollers have arrows: */
  88. #define SCROLLERIDCMP   (IDCMP_GADGETUP OR IDCMP_GADGETDOWN OR IDCMP_MOUSEMOVE)
  89. #define SLIDERIDCMP (IDCMP_GADGETUP OR IDCMP_GADGETDOWN OR IDCMP_MOUSEMOVE)
  90. #define STRINGIDCMP (IDCMP_GADGETUP)
  91.  
  92. #define TEXTIDCMP   (0&)
  93.  
  94. /*------------------------------------------------------------------------*/
  95.  
  96. /* Generic NewGadget used by several of the gadget classes: */
  97.  
  98. STRUCT NewGadget
  99.  
  100.     SHORTINT ng_LeftEdge 
  101.     SHORTINT   ng_TopEdge    /* gadget position */
  102.     SHORTINT ng_Width 
  103.     SHORTINT   ng_Height        /* gadget size */
  104.     ADDRESS   ng_GadgetText        /* gadget label */
  105.     TextAttrPtr  ng_TextAttr    /* desired font for gadget label */
  106.     SHORTINT ng_GadgetID           /* gadget ID */
  107.     LONGINT ng_Flags          /* see below */
  108.     ADDRESS ng_VisualInfo          /* Set to retval of GetVisualInfo() */
  109.     ADDRESS ng_UserData            /* gadget UserData */
  110. END STRUCT 
  111.  
  112.  
  113. /* ng_Flags control certain aspects of the gadget.  The first five control
  114.  * the placement of the descriptive text.  Each gadget kind has its default, 
  115.  * which is usually PLACETEXT_LEFT.  Consult the autodocs for details.
  116.  */
  117.  
  118. #define PLACETEXT_LEFT  &H0001  /* Right-align text on left side */
  119. #define PLACETEXT_RIGHT &H0002  /* Left-align text on right side */
  120. #define PLACETEXT_ABOVE &H0004  /* Center text above */
  121. #define PLACETEXT_BELOW &H0008  /* Center text below */
  122. #define PLACETEXT_IN    &H0010  /* Center text on */
  123.  
  124. #define NG_HIGHLABEL    &H0020  /* Highlight the label */
  125.  
  126.  
  127. /*------------------------------------------------------------------------*/
  128.  
  129. /* Fill out an array of these and pass that to CreateMenus(): */
  130.  
  131. STRUCT NewMenu
  132.  
  133.     BYTE  nm_Type       /* See below */
  134.  
  135.     /* C Compilers insert a PAD byte here, but ACE doesn't. So, we add one for ACE. */
  136.     BYTE nm_PadByte0
  137.  
  138.     ADDRESS nm_Label         /* Menu's label */
  139.     ADDRESS nm_CommKey       /* MenuItem Command Key Equiv */
  140.     SHORTINT nm_Flags      /* Menu or MenuItem flags (see note) */
  141.     LONGINT nm_MutualExclude   /* MenuItem MutualExclude SHORTINT */
  142.     ADDRESS nm_UserData        /* For your own use,  see note */
  143. END STRUCT 
  144.  
  145. /* Needed only by inside IM_ definitions below */
  146. #define MENU_IMAGE  128
  147.  
  148. /* nm_Type determines what each NewMenu structure corresponds to.
  149.  * for the NM_TITLE,  NM_ITEM,  and NM_SUB values,  nm_Label should
  150.  * be a text string to use for that menu title,  item,  or sub-item.
  151.  * For IM_ITEM or IM_SUB,  set nm_Label to point at the Image structure
  152.  * you wish to use for this item or sub-item.
  153.  * NOTE: At present,  you may only use conventional images.
  154.  * Custom images created from Intuition image-classes do not work.
  155.  */
  156. #define NM_TITLE    1   /* Menu header */
  157. #define NM_ITEM     2   /* Textual menu item */
  158. #define NM_SUB      3   /* Textual menu sub-item */
  159.  
  160. #define IM_ITEM     (NM_ITEM|MENU_IMAGE)    /* Graphical menu item */
  161. #define IM_SUB      (NM_SUB|MENU_IMAGE) /* Graphical menu sub-item */
  162.  
  163. /* The NewMenu array should be terminated with a NewMenu whose
  164.  * nm_Type equals NM_END.
  165.  */
  166. #define NM_END      0   /* End of NewMenu array */
  167.  
  168. /* Starting with V39,  GadTools will skip any NewMenu entries whose
  169.  * nm_Type field has the NM_IGNORE bit set.
  170.  */
  171. #define NM_IGNORE   64
  172.  
  173.  
  174. /* nm_Label should be a text string for textual items,  a pointer
  175.  * to an Image structure for graphical menu items,  or the special
  176.  * constant NM_BARLABEL,  to get a separator bar.
  177.  */
  178. /*#define NM_BARLABEL ((ADDRESS)-1)*/
  179. #define NM_BARLABEL -1&
  180.  
  181. /* The nm_Flags field is used to fill out either the Menu->Flags or
  182.  * MenuItem->Flags field.  Note that the sense of the MENUENABLED or
  183.  * ITEMENABLED bit is inverted between this use and Intuition's use, 
  184.  * in other words,  NewMenus are enabled by default.  The following
  185.  * labels are provided to disable them:
  186.  */
  187. #define NM_MENUDISABLED MENUENABLED
  188. #define NM_ITEMDISABLED ITEMENABLED
  189.  
  190. /* New for V39:  NM_COMMANDSTRING.  For a textual MenuItem or SubItem, 
  191.  * point nm_CommKey at an arbitrary string,  and set the NM_COMMANDSTRING
  192.  * flag.
  193.  */
  194. #define NM_COMMANDSTRING COMMSEQ
  195.  
  196. /* The following are pre-cleared (COMMSEQ,  ITEMTEXT,  and HIGHxxx are set
  197.  * later as appropriate):
  198.  * Under V39,  the COMMSEQ flag bit is not cleared,  since it now has
  199.  * meaning.
  200.  */
  201. #define NM_FLAGMASK (NOT(COMMSEQ OR ITEMTEXT OR HIGHFLAGS))
  202. #define NM_FLAGMASK_V39 (NOT(ITEMTEXT OR HIGHFLAGS))
  203.  
  204. /* You may choose among CHECKIT,  MENUTOGGLE,  and CHECKED.
  205.  * Toggle-select menuitems are of type CHECKIT|MENUTOGGLE,  along
  206.  * with CHECKED if currently selected.  Mutually exclusive ones
  207.  * are of type CHECKIT,  and possibly CHECKED too.  The nm_MutualExclude
  208.  * is a bit-wise representation of the items excluded by this one, 
  209.  * so in the simplest case (choose 1 among n),  these flags would be
  210.  * ~1,  ~2,  ~4,  ~8,  ~16,  etc.  See the Intuition Menus chapter.
  211.  */
  212.  
  213. /* A UserData pointer can be associated with each Menu and MenuItem structure.
  214.  * The CreateMenus() call allocates space for a UserData after each
  215.  * Menu or MenuItem (header,  item or sub-item).  You should use the
  216.  * GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it.
  217.  */
  218.  
  219.  
  220. #define GTMENU_INVALID  &H00000002  /* Invalid NewMenu array */
  221. #define GTMENU_NOMEM    &H00000003  /* Out of memory */
  222.  
  223. /*------------------------------------------------------------------------*/
  224.  
  225. /* Starting with V39,  checkboxes and mx gadgets can be scaled to your
  226.  * specified gadget width/height.  Use the new GTCB_Scaled or GTMX_Scaled
  227.  * tags,  respectively.  Under V37,  and by default in V39,  the imagery
  228.  * is of the following fixed size:
  229.  */
  230.  
  231. /* MX gadget default dimensions: */
  232. #define MX_WIDTH    17
  233. #define MX_HEIGHT   9
  234.  
  235. /* Checkbox default dimensions: */
  236. #define CHECKBOX_WIDTH  26
  237. #define CHECKBOX_HEIGHT 11
  238.  
  239. /*------------------------------------------------------------------------*/
  240.  
  241. /* Tags for GadTools functions: */
  242.  
  243. #define GT_TagBase       TAG_USER + &H80000
  244.  
  245. #define GTVI_NewWindow       GT_TagBase+1  /* Unused */
  246. #define GTVI_NWTags      GT_TagBase+2  /* Unused */
  247.  
  248. #define GT_Private0      GT_TagBase+3  /* (private) */
  249.  
  250. #define GTCB_Checked         GT_TagBase+4  /* State of checkbox */
  251.  
  252. #define GTLV_Top         GT_TagBase+5  /* Top visible one in listview */
  253. #define GTLV_Labels      GT_TagBase+6  /* List to display in listview */
  254. #define GTLV_ReadOnly        GT_TagBase+7  /* TRUE if listview is to be
  255.                         * read-only
  256.                         */
  257. #define GTLV_ScrollWidth     GT_TagBase+8  /* Width of scrollbar */
  258.  
  259. #define GTMX_Labels      GT_TagBase+9  /* NULL-terminated array of labels */
  260. #define GTMX_Active      GT_TagBase+10 /* Active one in mx gadget */
  261.  
  262. #define GTTX_Text        GT_TagBase+11 /* Text to display */
  263. #define GTTX_CopyText        GT_TagBase+12 /* Copy text label instead of
  264.                         * referencing it
  265.                         */
  266.  
  267. #define GTNM_Number      GT_TagBase+13 /* Number to display */
  268.  
  269. #define GTCY_Labels      GT_TagBase+14 /* NULL-terminated array of labels */
  270. #define GTCY_Active      GT_TagBase+15 /* The active one in the cycle gad */
  271.  
  272. #define GTPA_Depth       GT_TagBase+16 /* Number of bitplanes in palette */
  273. #define GTPA_Color       GT_TagBase+17 /* Palette color */
  274. #define GTPA_ColorOffset     GT_TagBase+18 /* First color to use in palette */
  275. #define GTPA_IndicatorWidth  GT_TagBase+19 /* Width of current-color indicator */
  276. #define GTPA_IndicatorHeight GT_TagBase+20 /* Height of current-color indicator */
  277.  
  278. #define GTSC_Top         GT_TagBase+21 /* Top visible in scroller */
  279. #define GTSC_Total       GT_TagBase+22 /* Total in scroller area */
  280. #define GTSC_Visible         GT_TagBase+23 /* Number visible in scroller */
  281. #define GTSC_Overlap         GT_TagBase+24 /* Unused */
  282.  
  283. /*  GT_TagBase+25 through GT_TagBase+37 are reserved */
  284.  
  285. #define GTSL_Min         GT_TagBase+38 /* Slider min value */
  286. #define GTSL_Max         GT_TagBase+39 /* Slider max value */
  287. #define GTSL_Level       GT_TagBase+40 /* Slider level */
  288. #define GTSL_MaxLevelLen     GT_TagBase+41 /* Max length of printed level */
  289. #define GTSL_LevelFormat     GT_TagBase+42 /* Format string for level */
  290. #define GTSL_LevelPlace      GT_TagBase+43 /* Where level should be placed */
  291. #define GTSL_DispFunc        GT_TagBase+44 /* Callback for number calculation
  292.                         * before display
  293.                         */
  294.  
  295. #define GTST_String      GT_TagBase+45 /* String gadget's displayed string */
  296. #define GTST_MaxChars        GT_TagBase+46 /* Max length of string */
  297.  
  298. #define GTIN_Number      GT_TagBase+47 /* Number in integer gadget */
  299. #define GTIN_MaxChars        GT_TagBase+48 /* Max number of digits */
  300.  
  301. #define GTMN_TextAttr        GT_TagBase+49 /* MenuItem font TextAttr */
  302. #define GTMN_FrontPen        GT_TagBase+50 /* MenuItem text pen color */
  303.  
  304. #define GTBB_Recessed        GT_TagBase+51 /* Make BevelBox recessed */
  305.  
  306. #define GT_VisualInfo        GT_TagBase+52 /* result of VisualInfo call */
  307.  
  308. #define GTLV_ShowSelected    GT_TagBase+53 /* show selected entry beneath
  309.         * listview,  set tag data = NULL for display-only,  or pointer
  310.         * to a string gadget you've created
  311.         */
  312. #define GTLV_Selected        GT_TagBase+54 /* Set ordinal number of selected
  313.                         * entry in the list
  314.                         */
  315. #define GT_Reserved1         GT_TagBase+56 /* Reserved for future use */
  316.  
  317. #define GTTX_Border      GT_TagBase+57 /* Put a border around
  318.                         * Text-display gadgets
  319.                         */
  320. #define GTNM_Border      GT_TagBase+58 /* Put a border around
  321.                         * Number-display gadgets
  322.                         */
  323.  
  324. #define GTSC_Arrows      GT_TagBase+59 /* Specify size of arrows for
  325.                         * scroller
  326.                         */
  327.  
  328. #define GTMN_Menu        GT_TagBase+60 /* Pointer to Menu for use by
  329.                         * LayoutMenuItems()
  330.                         */
  331. #define GTMX_Spacing         GT_TagBase+61 /* Added to font height to
  332.         * figure spacing between mx choices.  Use this instead
  333.         * of LAYOUTA_SPACING for mx gadgets.
  334.         */
  335.  
  336. /* New to V37 GadTools.  Ignored by GadTools V36 */
  337. #define GTMN_FullMenu        GT_TagBase+62 /* Asks CreateMenus() to
  338.         * validate that this is a complete menu structure
  339.         */
  340. #define GTMN_SecondaryError  GT_TagBase+63 /* ti_Data is a pointer
  341.         * to a LONGINT to receive error reports from CreateMenus()
  342.         */
  343. #define GT_Underscore        GT_TagBase+64 /* ti_Data points to the symbol
  344.         * that preceeds the character you'd like to underline in a
  345.         * gadget label
  346.         */
  347. #define GTST_EditHook        GT_TagBase+55 /* String EditHook */
  348. #define GTIN_EditHook        GTST_EditHook /* Same thing,  different name, 
  349.         * just to round out INTEGER_KIND gadgets
  350.         */
  351.  
  352. /* New to V39 GadTools.  Ignored by GadTools V36 and V37 */
  353. #define GTMN_Checkmark       GT_TagBase+65 /* ti_Data is checkmark img to use */
  354. #define GTMN_AmigaKey        GT_TagBase+66 /* ti_Data is Amiga-key img to use */
  355. #define GTMN_NewLookMenus    GT_TagBase+67 /* ti_Data is boolean */
  356.  
  357. /* New to V39 GadTools.  Ignored by GadTools V36 and V37.
  358.  * Set to TRUE if you want the checkbox or mx image scaled to
  359.  * the gadget width/height you specify.  Defaults to FALSE, 
  360.  * for compatibility.
  361.  */
  362. #define GTCB_Scaled      GT_TagBase+68 /* ti_Data is boolean */
  363. #define GTMX_Scaled      GT_TagBase+69 /* ti_Data is boolean */
  364.  
  365. #define GTPA_NumColors       GT_TagBase+70 /* Number of colors in palette */
  366.  
  367. #define GTMX_TitlePlace      GT_TagBase+71 /* Where to put the title */
  368.  
  369. #define GTTX_FrontPen        GT_TagBase+72 /* Text color in TEXT_KIND gad */
  370. #define GTTX_BackPen         GT_TagBase+73 /* Bgrnd color in TEXT_KIND gad */
  371. #define GTTX_Justification   GT_TagBase+74 /* See GTJ_#? constants */
  372.  
  373. #define GTNM_FrontPen        GT_TagBase+72 /* Text color in NUMBER_KIND gad */
  374. #define GTNM_BackPen         GT_TagBase+73 /* Bgrnd color in NUMBER_KIND gad */
  375. #define GTNM_Justification   GT_TagBase+74 /* See GTJ_#? constants */
  376. #define GTNM_Format      GT_TagBase+75 /* Formatting string for number */
  377. #define GTNM_MaxNumberLen    GT_TagBase+76 /* Maximum length of number */
  378.  
  379. #define GTBB_FrameType       GT_TagBase+77 /* defines what kind of boxes
  380.                         * DrawBevelBox() renders. See
  381.                         * the BBFT_#? constants for
  382.                         * possible values
  383.                         */
  384.  
  385. #define GTLV_MakeVisible     GT_TagBase+78 /* Make this item visible */
  386. #define GTLV_ItemHeight      GT_TagBase+79 /* Height of an individual item */
  387.  
  388. #define GTSL_MaxPixelLen     GT_TagBase+80 /* Max pixel size of level display */
  389. #define GTSL_Justification   GT_TagBase+81 /* how should the level be displayed */
  390.  
  391. #define GTPA_ColorTable      GT_TagBase+82 /* colors to use in palette */
  392.  
  393. #define GTLV_CallBack        GT_TagBase+83 /* general-purpose listview call back */
  394. #define GTLV_MaxPen      GT_TagBase+84 /* maximum pen number used by call back */
  395.  
  396. #define GTTX_Clipped         GT_TagBase+85 /* make a TEXT_KIND clip text */
  397. #define GTNM_Clipped         GT_TagBase+85 /* make a NUMBER_KIND clip text */
  398.  
  399. /* Old definition,  now obsolete: */
  400. #define GT_Reserved0         GTST_EditHook
  401.  
  402. /*------------------------------------------------------------------------*/
  403.  
  404. /* Justification types for GTTX_Justification and GTNM_Justification tags */
  405. #define GTJ_LEFT   0
  406. #define GTJ_RIGHT  1
  407. #define GTJ_CENTER 2
  408.  
  409. /*------------------------------------------------------------------------*/
  410.  
  411. /* Bevel box frame types for GTBB_FrameType tag */
  412. #define BBFT_BUTTON  1  /* Standard button gadget box */
  413. #define BBFT_RIDGE   2  /* Standard string gadget box */
  414. #define BBFT_ICONDROPBOX 3  /* Standard icon drop box     */
  415.  
  416. /*------------------------------------------------------------------------*/
  417.  
  418. /* Typical suggested spacing between "elements": */
  419. #define INTERWIDTH  8
  420. #define INTERHEIGHT 4
  421.  
  422. /*------------------------------------------------------------------------*/
  423.  
  424. /* "NWay" is an old synonym for cycle gadgets */
  425. #define NWAY_KIND   CYCLE_KIND
  426. #define NWAYIDCMP   CYCLEIDCMP
  427. #define GTNW_Labels GTCY_Labels
  428. #define GTNW_Active GTCY_Active
  429.  
  430. /*------------------------------------------------------------------------*/
  431.  
  432. /* These two definitions are obsolete,  but are here for backwards
  433.  * compatibility.  You never need to worry about these:
  434.  */
  435. #define GADTOOLBIT  (&H8000)
  436. /* Use this mask to isolate the user part: */
  437. #define GADTOOLMASK (NOT GADTOOLBIT)
  438.  
  439. /*------------------------------------------------------------------------*/
  440.  
  441. /* These definitions are for the GTLV_CallBack tag */
  442.  
  443. /* The different types of messages that a listview callback hook can see */
  444. #define LV_DRAW       &H202&    /* draw yourself,  with state */
  445.  
  446. /* Possible return values from a callback hook */
  447. #define LVCB_OK       0     /* callback understands this message type    */
  448. #define LVCB_UNKNOWN  1     /* callback does not understand this message */
  449.  
  450. /* states for LVDrawMsg.lvdm_State */
  451. #define LVR_NORMAL        0 /* the usual             */
  452. #define LVR_SELECTED          1 /* for selected gadgets      */
  453. #define LVR_NORMALDISABLED    2     /* for disabled gadgets      */
  454. #define LVR_SELECTEDDISABLED  8     /* disabled and selected     */
  455.  
  456. /* structure of LV_DRAW messages,  object is a (STRUCT Node *) */
  457. STRUCT LVDrawMsg
  458.  
  459.     LONGINT         lvdm_MethodID    /* LV_DRAW           */
  460.     RastPortPtr  lvdm_RastPort    /* where to render to        */
  461.     DrawInfoPtr  lvdm_DrawInfo    /* useful to have around     */
  462.     Rectangle lvdm_Bounds      /* limits of where to render */
  463.     LONGINT         lvdm_State       /* how to render     */
  464. END STRUCT 
  465.  
  466. /*------------------------------------------------------------------------*/
  467.  
  468.  
  469.  
  470. #endif /* LIBRARIES_GADTOOLS_H */
  471.